home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / dash.preinst < prev    next >
Encoding:
Text File  |  2010-12-14  |  1.0 KB  |  33 lines

  1. #!/bin/bash
  2. set -e
  3.  
  4. divert() {
  5.     dfile=$1
  6.     ltarget=$2
  7.     div=$(dpkg-divert --list $dfile)
  8.     distrib=${3:-$dfile.distrib}
  9.     temp=$dfile.tmp
  10.     if [ -z "$div" ]; then
  11.         # This differs from dpkg-divert's --rename because we
  12.         # first make a copy of $dfile (the file being diverted)
  13.         # in $distrib. Then, a symlink to $ltarget is forcibly created
  14.         # from $dfile; this is performed in two stages with an
  15.         # intermediate temporary file as ln -sf is not atomic.
  16.         # dpkg-divert's --rename direct equivalent would be:
  17.         # mv $dfile $distrib -- but we could end up without a symlink
  18.         if [ -e $dfile ]; then
  19.             cp -dp $dfile $distrib
  20.         fi
  21.         ln -sf $ltarget $temp
  22.         mv -f $temp $dfile
  23.         dpkg-divert --package dash --divert $distrib --add $dfile
  24.     fi
  25. }
  26.  
  27. # Divert the following files if no diversion exists already
  28. # It is currently used to prevent the files collision between bash and
  29. # dash: they both provide the files in the package.
  30. divert /bin/sh dash
  31. divert /usr/share/man/man1/sh.1.gz dash.1.gz \
  32.     /usr/share/man/man1/sh.distrib.1.gz
  33.